home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / vttxyam.lha / MailTo-YAM.VRX next >
Text File  |  1996-05-06  |  3KB  |  103 lines

  1. /* MailTo-YAM.VRX by Michel 'Bitstorm' Labbé <mlabbe@quebectel.com>
  2. **
  3. ** TurboText modifications by Ivan 'OzDuDe' Smith <ivans@zeta.org.au>
  4. ** Original Comments by Michel 'Bitstorm' Labbé <mlabbe@quebectel.com>
  5. ** Additional Comments by Ivan Smith signified by //\\
  6. **
  7. ** $VER: MailTo-YAM v1.06 (29.04.96)
  8. **
  9. ** This is a very simple script designed for use with Voyager's new mailto:
  10. ** support.
  11. **
  12. ** Thanks to Mike Fitzgerald for the original script
  13. ** Credits also goes to: DFDuck for helping me with ARexx programming
  14. **                       Phideaux for early betatesting
  15. **                       Olli for writing very nice softwares such as V
  16. **
  17. ** //\\Set Voyager's 'mailto:' string as follows:
  18. ** //\\
  19. ** //\\mailto: App [REXXC/RX path:to/Voyager/Rexx/MailTo-YAM.VRX %h]
  20. **
  21. ** Now change the variables below to whatever fits for your setup.
  22. **
  23. ** Notes: YAM must be running for the script to work
  24. ** Known bug(s):
  25. ** The script won't send the mail if YAM wasn't already running when you
  26. ** started the script and you have "Get mail on startup" turned on.  To
  27. ** fix this, turn off that flag in YAM's configs.
  28. */
  29.  
  30. AddSignature = 'Yes'           /* use YAM's signature      */
  31. PopOnVScreen = 'No'            /* pop TTX on V's pubscreen?*/
  32. Editor       = 'Turbotext:TTX' /* path/name of the editor  */
  33. Subject      = 'Mailto: from your URL'  /* subject for the message */
  34. YAMPath      = 'YAM:'          /* must end with : or /  */
  35.  
  36. parse arg mailto
  37.  
  38. /* check for the presence of Libs:rexxsupport.library */
  39.  
  40. if ~show('L','rexxsupport.library') then do
  41.         if addlib('rexxsupport.library',0,-30,0) then nop
  42.         else do
  43.                 call showerror('This script needs the rexxsupport.library to work properly.  This file can be found on your original Workbench 2+ disks and should be placed in Libs:')
  44.                 exit 20
  45.         end
  46. end
  47.  
  48. /* add YAM's signature if YAM:.signature file exists */
  49.  
  50. if(upper(AddSignature) = 'YES') then do
  51.         if exists(YAMPath'.signature') then
  52.                 shell command 'copy 'YAMPath'.signature t:mail'
  53.         else
  54.                 do      call showerror('No signature file found! Please correct this in YAM or turn off signature adding in MailTo-YAM.VRX<BR>You should also check the YAMPath in MailTo-YAM.VRX')
  55.                         exit 20
  56.                 end
  57. end
  58.  
  59.  
  60. /* send the mail from YAM */
  61.  
  62. call pragma('stack',10000)
  63.  
  64. if upper(PopOnVScreen) = 'YES' then
  65.         address command (editor' -wait t:mail')
  66. else address command (editor' wait t:mail')
  67.  
  68. /* look for YAM process */
  69. if ~show('P','YAM') then do
  70.         shell command 'Run <>NIL: YAM:YAM'
  71.         do until show('P','YAM')
  72.                 call delay(50)  /* needs rexxsupport.library */
  73.         end
  74. end
  75.  
  76. address YAM
  77. WriteMailTo mailto
  78. 'WriteSubject "'Subject'"'
  79. WriteLetter 'T:Mail'
  80. WriteQueue
  81. MailSendAll
  82. call delete('t:mail')  (rexxsupport.library)
  83.  
  84. EXIT
  85.  
  86. /* sophisticated errorhandling (ripped from MailTo-THOR.VRX) :-) */
  87.  
  88. showerror:
  89.         parse arg errormsg
  90.  
  91.         p=show('P',,)
  92.         if(pos('MINDWALKER', p) > 0) then vport = word(substr(p, pos('MINDWALKER', p)), 1)
  93.         else return
  94.  
  95.         call open(err, "T:MailTo-YAM.error.html", W)
  96.         call writeln(err, "<HTML><HEAD><TITLE>MailTo-YAM.VRX encountered an error</TITLE></HEAD><BODY><H1>Sending mail aborted</H1>" || errormsg || ".")
  97.         call close(err)
  98.  
  99.         address(vport)
  100.         'openURL file://localhost/T:MailTo-YAM.error.html'
  101.  
  102.         return
  103.